<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});

Route::get("get", function () {
    dd(request()->all());
});

Route::get('hello/:name', 'index/hello');
Route::get('wx', function () {
    $config = [
        'corp_id' => 'wwd6c3e7b79a384bed',

        'agent_id' => 1000005, // 如果有 agend_id 则填写
        'secret'   => 'lo4WGE0tC2Co1AglMtXzidS2Z2u0XGExIHLFiHrItxo',

        'response_type' => 'array',

        'token' => 'kPVdetbl4QyFbpp6JIEZTSVC2',
        'aes_key' => 'TtwHKC2MPFG1faoIivAQDt5OBcsC9m78Y9P4PUpBgo3',

        'log' => [
            'level' => 'debug',
            'file' => __DIR__.'/wechat.log',
        ],
    ];

    $app = \EasyWeChat\Factory::work($config);

    $response = $app->server->serve();
    $response->send();
});

Route::get('send-wx-msg', function () {
    $config = [
        'corp_id' => 'wwd6c3e7b79a384bed',

//        'agent_id' => 1000005, // 如果有 agend_id 则填写
        'secret'   => 'Llucu2tUB9s6jGgpOOIOdIu_MHXoaZvHRXFSD2m1ph4',
//
        'response_type' => 'array',

        'log' => [
            'level' => 'debug',
            'file' => __DIR__.'/wechat.log',
        ],
    ];

    $app = \EasyWeChat\Factory::work($config);

    $messenger = $app->group_robot_messenger;
    $groupKey = '2084eea8-017c-411e-a878-d56de6c9b87c';
    $text = new \EasyWeChat\Work\GroupRobot\Messages\Text('接受到你的消息');
    $text->mention('YiGeMao');
    dd($messenger->message($text)->toGroup($groupKey)->send());
});

Route::get('token', function () {
    dd((new \app\server\SendNotice())->run());
});
